<template>
  <el-dialog v-model="dialogFormVisible" title="Shipping address" width="500">
    <el-form :model="form">
      <el-form-item label="监督员编号" :label-width="formLabelWidth">
        <el-input v-model="form.pid" readonly autocomplete="off" />
      </el-form-item>
      <el-form-item label="姓名" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
      <el-form-item label="电话" :label-width="formLabelWidth">
        <el-input v-model="form.tel" autocomplete="off" />
      </el-form-item>
      <el-form-item label="年龄" :label-width="formLabelWidth">
        <el-input v-model="form.age" autocomplete="off" />
      </el-form-item>
      <el-form-item label="邮箱" :label-width="formLabelWidth">
        <el-input v-model="form.email" autocomplete="off" />
      </el-form-item>
      <el-form-item label="角色" :label-width="formLabelWidth">
        <RoleSelect :roleId="form.roleid"></RoleSelect>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogFormVisible = false">Cancel</el-button>
        <el-button type="primary" :icon="Promotion" @click="doSave"> 保存 </el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import { usePersonStore } from '@/stores/person'
import { storeToRefs } from 'pinia'
import RoleSelect from '../role/RoleSelect.vue'
import { Promotion } from '@element-plus/icons-vue'
const personStore = usePersonStore()
const { dialogFormVisible, form } = storeToRefs(personStore)

const doSave = () => {
  personStore.save()
}

const formLabelWidth = '140px'
</script>
